package com.jinlingxiu.app.other.bean

class SolutionBean {
    var soundType: String = ""
    var soundInitials: MutableList<String> = mutableListOf()
    var tongueTwister: String = ""

    override fun equals(other: Any?): Boolean {
        if (soundType.isNotEmpty() && other is SolutionBean) {
            return this.soundType == other.soundType
        }
        return super.equals(other)
    }

    fun getTitle(): String {
        var append = StringBuffer()
        soundInitials.forEach {
            append.append("$it、")
        }
        val removeSuffix = append.toString().removeSuffix("、")
        return "${soundType}${removeSuffix}: "
    }

    fun getTongue(): String {
        val split = tongueTwister.split("\\s+".toRegex())
        var append = StringBuffer()
        split.forEach {
            append.append("${it.trim()}\n")
        }
        return append.toString()
    }
}

data class SolutionAdapterBean(var description: String)